//
//  AuctionRecordVC.m
//  phmall
//
//  Created by admin on 2017/12/5.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "AuctionRecordVC.h"
#import "AuctionRecordViewCell.h"
@interface AuctionRecordVC ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *myTableview;
@end

@implementation AuctionRecordVC

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    //隐藏标签栏
    self.navBarBgAlpha=@"1.0";
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIBarButtonItem* leftBar=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"返回"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(leftBarAction)];
    
    self.navigationItem.leftBarButtonItem=leftBar;
    
    self.title=@"拍卖记录";

    UIView *head=[[UIView alloc]init];
    head.backgroundColor=[UIColor groupTableViewBackgroundColor];
    [self.view addSubview:head];
    [head mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.top.offset(0);
        make.height.offset(44);
    }];
    
    UILabel *type=[[UILabel alloc]init];
    type.text=@"状态";
    type.font=[UIFont systemFontOfSize:13];
    type.textColor=[UIColor blackColor];
    [head addSubview:type];
    
    UILabel *name=[[UILabel alloc]init];
    name.text=@"竞拍人";
    name.textColor=[UIColor blackColor];
    name.font=[UIFont systemFontOfSize:13];
    [head addSubview:name];
    
    UILabel *price=[[UILabel alloc]init];
    price.text=@"竞拍价格";
    price.textColor=[UIColor blackColor];
    price.font=[UIFont systemFontOfSize:13];
    [head addSubview:price];
    
    UILabel *time=[[UILabel alloc]init];
    time.text=@"时间";
    time.textAlignment=NSTextAlignmentCenter;
    time.textColor=[UIColor blackColor];
    time.font=[UIFont systemFontOfSize:13];
    [head addSubview:time];
    
    
    [type mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.left.offset(10);
        make.width.offset(37);
        make.height.offset(22);
    }];
    
    [name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.left.equalTo(type.mas_right).offset(20);
        make.width.offset(50);
    }];
    
    [price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.width.offset((SCREEN_WIDTH-140)/3);
        make.left.equalTo(name.mas_right).offset(20);
    }];
    
    [time mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.offset(0);
        make.right.equalTo(head).offset(-10);
        make.left.equalTo(price.mas_right).offset(20);
    }];
    
    [self.view addSubview:self.myTableview];
    [self.myTableview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(head.mas_bottom).offset(0);
        make.left.right.equalTo(self.view);
        make.bottom.equalTo(self.view);
    }];
    // Do any additional setup after loading the view.
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 5;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.01;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    AuctionRecordViewCell *cell=[AuctionRecordViewCell theShareCellWithTableView:tableView];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    //分割线补全
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]){
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
}

//MARK:-GETTER
- (UITableView *)myTableview{
    if (!_myTableview) {
        _myTableview = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        _myTableview.delegate = self;
        _myTableview.dataSource = self;
        _myTableview.backgroundColor=[UIColor whiteColor];
        _myTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
        _myTableview.showsVerticalScrollIndicator=NO;
        _myTableview.scrollEnabled = YES;
    }
    return _myTableview;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
